## 样式
from docx import Document
from docx.enum.style import WD_STYLE_TYPE
from docx.enum.text import WD_PARAGRAPH_ALIGNMENT
docx =Document()

# p1 = docx.add_paragraph(text='左对齐')
# p2 = docx.add_paragraph(text='右对齐')
# p3 = docx.add_paragraph(text='居中对齐')
# p4 = docx.add_paragraph(text='两端对齐')
# p5 = docx.add_paragraph(text='分散对齐')
#
# p1.alignment = WD_PARAGRAPH_ALIGNMENT.LEFT
# p2.alignment = WD_PARAGRAPH_ALIGNMENT.RIGHT
# p3.alignment = WD_PARAGRAPH_ALIGNMENT.CENTER
# p4.alignment = WD_PARAGRAPH_ALIGNMENT.JUSTIFY
# p5.alignment = WD_PARAGRAPH_ALIGNMENT.DISTRIBUTE
styles = docx.styles
paragraph_styles = [s for s in styles if s.type == WD_STYLE_TYPE.PARAGRAPH]
for style in paragraph_styles :
    print(style.name)
    print(style)
docx.save(r'D:\Desktop\word\a.docx')